<?php
namespace app\api\controller;
use app\api\controller\BaseController;
use app\common\errcode\ApiErrCode;
use app\common\errcode\ApiErrMsg;
use think\Loader;

class TosController extends BaseController
{
    public function token()
    {
        try {
            //从python获取临时token
            $url = "https://fc.souxiu.cn/video_pretest/temp_token";
            // $res = json_decode(file_get_contents($url),true);
            $res = httpRequest($url);
            if(isset($res['Result']['Credentials'])){
                return $this->jsonJump(ApiErrCode::SUCCESS,ApiErrMsg::SUCCESS,$res['Result']['Credentials']);    
            }
            return $this->jsonJump(ApiErrCode::TEMP_TOKEN_ERROR,ApiErrMsg::TEMP_TOKEN_ERROR);
        } catch (\Exception $e) {
            \app\common\model\CommonModel::savelog(0,$e,$this->request->path());
            return $this->jsonJump(ApiErrCode::SYSTEM_ERROR,ApiErrMsg::SYSTEM_ERROR . ',错误信息:'. $e->getMessage());
        }    
    }
}